Initialise cpu ops after enabling data cache
authorVikram Kanigiri <vikram.kanigiri@arm.com>
Thu, 29 Jan 2015 18:27:38 +0000 (18:27 +0000)
committerVikram Kanigiri <vikram.kanigiri@arm.com>
Fri, 13 Mar 2015 10:38:09 +0000 (10:38 +0000)
The cpu-ops pointer was initialized before enabling the data cache in the cold
and warm boot paths. This required a DCIVAC cache maintenance operation to
invalidate any stale cache lines resident in other cpus.

This patch moves this initialization to the bl31_arch_setup() function
which is always called after the data cache and MMU has been enabled.

This change removes the need:
 1. for the DCIVAC cache maintenance operation.
 2. to initialise the CPU ops upon resumption from a PSCI CPU_SUSPEND
    call since memory contents are always preserved in this case.

Change-Id: Ibb2fa2f7460d1a1f1e721242025e382734c204c6

bl31/aarch64/bl31_arch_setup.c
bl31/aarch64/bl31_entrypoint.S
include/bl31/cpu_data.h
lib/cpus/aarch64/cpu_helpers.S
services/std_svc/psci/psci_entry.S

index a88b029ea38f2f00f62c741d3ee850a8f648d362..edf10188d339bb759a8ea746e4ed21a6c216c2c7 100644 (file)
@@ -33,6 +33,7 @@
 #include <assert.h>
 #include <bl_common.h>
 #include <bl31.h>
+#include <cpu_data.h>
 #include <platform.h>
 
 /*******************************************************************************
@@ -47,4 +48,7 @@ void bl31_arch_setup(void)
 
        /* Program the counter frequency */
        write_cntfrq_el0(plat_get_syscnt_freq());
+
+       /* Initialize the cpu_ops pointer. */
+       init_cpu_ops();
 }
index 01d7a7f5317d1d5bc5a9bf21e6aba5c5c8601956..186b1cbc2396f66379e93140468a337a7ebfddc9 100644 (file)
@@ -161,12 +161,6 @@ func bl31_entrypoint
        bl      zeromem16
 #endif
 
-       /* ---------------------------------------------
-        * Initialize the cpu_ops pointer.
-        * ---------------------------------------------
-        */
-       bl      init_cpu_ops
-
        /* ---------------------------------------------
         * Use SP_EL0 for the C runtime stack.
         * ---------------------------------------------
index 1926e292a9752b15547238f4c08ecd75555e5ee0..50f509bbdaba391de4eee664588a4c3114c87fe1 100644 (file)
@@ -117,6 +117,7 @@ static inline struct cpu_data *_cpu_data(void)
  *************************************************************************/
 
 void init_cpu_data_ptr(void);
+void init_cpu_ops(void);
 
 #define get_cpu_data(_m)                  _cpu_data()->_m
 #define set_cpu_data(_m, _v)              _cpu_data()->_m = _v
index bebe7c0a52de37ce54f748533a067c56f03cec63..24c283ab0aa5ca5bf13511493044dd84ffd6681c 100644 (file)
@@ -110,7 +110,8 @@ func prepare_cluster_pwr_dwn
 
        /*
         * Initializes the cpu_ops_ptr if not already initialized
-        * in cpu_data. This can be called without a runtime stack.
+        * in cpu_data. This can be called without a runtime stack, but may
+        * only be called after the MMU is enabled.
         * clobbers: x0 - x6, x10
         */
        .globl  init_cpu_ops
@@ -125,18 +126,6 @@ func init_cpu_ops
        ASM_ASSERT(ne)
 #endif
        str     x0, [x6, #CPU_DATA_CPU_OPS_PTR]!
-
-       /*
-        * Make sure that any pre-fetched cache copies are invalidated.
-        * Ensure that we are running with cache disable else we
-        * invalidate our own update.
-        */
-#if ASM_ASSERTION
-       mrs     x1, sctlr_el3
-       tst     x1, #SCTLR_C_BIT
-       ASM_ASSERT(eq)
-#endif
-       dc      ivac, x6
        mov x30, x10
 1:
        ret
index 3e67d34499ef48d91a54d9c627180591c7c34f77..fb3f00761985aec61d2dc92ea10b0444b24b6bae 100644 (file)
@@ -86,12 +86,6 @@ psci_aff_common_finish_entry:
         */
        bl      init_cpu_data_ptr
 
-       /* ---------------------------------------------
-        * Initialize the cpu_ops pointer.
-        * ---------------------------------------------
-        */
-       bl      init_cpu_ops
-
        /* ---------------------------------------------
         * Set the exception vectors
         * ---------------------------------------------